<template>
  <van-image class="avatar" lazy-load round :src="src">
    <img class="default-avatar" slot="error" :src="defaultAvatar" alt="">
  </van-image>
</template>

<script>
export default {
  name: 'Avatar',
  props: {
    src: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
      defaultAvatar: require('../assets/user.png')
    }
  }
}
</script>

<style scoped lang="less">
.avatar {
  .default-avatar {
    width: 100%;
  }
}
</style>
